package org.openclinic.to;

public class AjaxResponse {
	
	public static final AjaxResponse SUCCESS = new AjaxResponse(true, null);

	private boolean success;
	
	private String message;

	public AjaxResponse(String message) {
		this(false, message);
	}
	
	public AjaxResponse(boolean success, String message) {
		if (!success && (message == null || message.isEmpty())) {
			throw new IllegalArgumentException("Causa não especificada.");
		}
		this.success = success;
		this.message = message;
	}
	
	public boolean isSuccess() {
		return success;
	}

	public String getMessage() {
		return message;
	}

}
